import React, { Component } from 'react';
import Myswiper from '../../components/Myswiper';
import Input from '../../components/index/Input';
import MyEntry from '../../components/index/MyEntry';
import MySeckill from '../../components/index/MySeckill';
// 导入封装请求
import { index_banner } from '../../api/index'
class Home extends Component {
    constructor(props) {
        super(props);
        this.state = {
            bannerlist: []
        }
    }
    // 请求轮播图数据
    async componentDidMount() {
        var res = await index_banner()
        if (res.data.code == 200) {
            this.setState({ bannerlist: res.data.list })
        }
    }

    render() {
        return (
            <div className='home'>
                {/* 搜索框 */}
                <Input />
                {/* 轮播图 */}
                <Myswiper swiperlist={this.state.bannerlist} />
                {/* 秒杀区 */}
                <MyEntry />
                {/* 值得买 */}
                <MySeckill />
            </div>
        );
    }
}

export default Home;